<template>
	<view style="padding-bottom: 150rpx;" v-if="pageShow">
		<view class="mainpadding_top ffffff">
			<view class="margin_top2 flexbetween">
				<view class="shilitu">
					<image :src="dataAll.goods_image_text" mode=""></image>
				</view>
				<view class="flexcolumnbet" style="width: 66%;height: 180rpx;">
					<view class="xiaohei titletext fonweight xiankuan">{{dataAll.goods_name}}</view>
					<view class="xiaohei titletext nofonweight">总金额：<text
							class="xiaohong titletext fonweight">￥{{Number(dataAll.pay_price) + Number(dataAll.score)}}</text>
					</view>
					<view class="xiaohei titletext nofonweight">平台抵扣金额：<text
							class="xiaohong titletext fonweight">￥{{dataAll.score}}</text></view>
					<view class="flexbetween" style="width: 100%">
						<view class="xiaohui titletext nofonweight margin_top1">*1</view>
						<view class="xiaohei titletext nofonweight margin_top1">实际支付金额：
							<text class="xiaohong titletext fonweight">￥{{dataAll.pay_price}}</text>
						</view>
					</view>

				</view>
			</view>
		</view>
		<view class="mainpadding margin_top ffffff">
			<view class="titletext sanshier fonweight">卖家信息</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">持卡人</view>
				<view class="strongtext">{{dataAll.userinfo.nickname}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">手机号</view>
				<view class="strongtext">{{dataAll.userinfo.mobile}}</view>
			</view>
		</view>
		<view class="mainpadding margin_top ffffff" v-if="dataAll.userinfo.bank_no">
			<view class="titletext sanshier fonweight">卖家银行卡信息</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">持卡人</view>
				<view class="strongtext">{{dataAll.userinfo.bank_username}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">银行卡号</view>
				<view class="strongtext	">{{dataAll.userinfo.bank_no}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">所属银行</view>
				<view class="strongtext	">{{dataAll.userinfo.open_bank}}</view>
			</view>
		</view>
		<view class="mainpadding margin_top  ffffff"
			v-if="dataAll.userinfo.ali_image_text || dataAll.userinfo.wechat_image_text">
			<view class="flexaround">
				<view class="" v-if="dataAll.userinfo.ali_image_text">
					<view class="titletext sanshier flexcenter  fonweight">支付宝收款码</view>
					<view class="flexcenter margin_top">
						<image :src="dataAll.userinfo.ali_image_text" mode="widthFix"
							@click="lbtpriview(0,dataAll.userinfo.ali_image_text)" style="width: 200rpx;"></image>
					</view>
				</view>
				<view class="" v-if="dataAll.userinfo.wechat_image_text">
					<view class="titletext sanshier flexcenter fonweight">微信收款码</view>
					<view class="flexcenter margin_top">
						<image :src="dataAll.userinfo.wechat_image_text" mode="widthFix"
							@click="lbtpriview(0,dataAll.userinfo.wechat_image_text)" style="width: 200rpx;"></image>
					</view>
				</view>
			</view>
			<!-- <view class="flexcenter margin_top xiaohong smalltext">*	点击图片长按保存</view> -->
		</view>
		<view class="mainpadding margin_top ffffff">
			<view class="titletext sanshier fonweight">买家信息</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">持卡人</view>
				<view class="strongtext">{{dataAll.pay_userinfo.nickname}}</view>
			</view>
			<view class="flexbetween margin_top">
				<view class="strongtext">手机号</view>
				<view class="strongtext">{{dataAll.pay_userinfo.mobile}}</view>
			</view>
		</view>
		<view class="mainpadding margin_top ffffff">
			<view class="titletext sanshier flexcenter fonweight">点击上传支付凭证</view>
			<view class="flexcenter margin_top" @click="uploadImg(1,avatar,avatar_text)">
				<image src="../../static/image/sysem/upimg.png" v-if="!fk_image" mode="widthFix" style="width: 200rpx;">
				</image>
				<image :src="fk_image_text" v-else mode="widthFix" style="width: 200rpx;"></image>
			</view>
		</view>

		<view class="gudingdb ffffff mainpadding">
			<view class="bigbtn" @click="submit(listid)">确认付款</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listid: "",
				dataAll: {},
				pageShow: false,
				fk_image: "",
				fk_image_text: "",
			}
		},
		onLoad(options) {
			this.listid = options.id
		},
		onShow() {
			this.getDetail()
		},
		methods: {
			submit(id) {
				if (this.fk_image == "") {
					httpRequest.toast("请上传支付凭证")
					return false
				}
				httpRequest.request('/api/cccl/myBuyOrderPay', 'GET', {
					order_id: id,
					fk_image: this.fk_image
				}).then(res => {
					httpRequest.toast(res.msg)
					if (res.code == 1) {
						setTimeout(() => {
							uni.navigateBack(1)
						}, 1000)
					}
				})
			},
			uploadImg(value, upImgs, upImgs_text) {
				let _this = this;
				uni.showActionSheet({
					itemList: ['相机', '相册'],
					success: function(res) {
						// 选择相机走0
						if (res.tapIndex == 0) {
							httpRequest.chooseImage(1, ['camera']).then(res => {
								for (var i = 0; i < res.length; i++) {
									_this.uploadImageService(res[i], upImgs, upImgs_text)
								}
							}).catch(err => {});
						}
						// 选择相册走1
						if (res.tapIndex == 1) {
							httpRequest.chooseImage(1, ['album']).then(res => {
								for (var i = 0; i < res.length; i++) {
									_this.uploadImageService(res[i], upImgs, upImgs_text)
								}
							}).catch(err => {});
						}
					},
					fail: function(res) {}
				});
			},
			uploadImageService(url, upImg, upImgs_text) {
				let _this = this;
				httpRequest.uploadFile('/api/common/upload', url).then(res => {
					let image_item = res.fullurl;
					this.fk_image = res.url;
					this.fk_image_text = image_item
				}).catch(err => {});
			},
			lbtpriview(index, val) {
				var i = [val]; //获取当前页面的轮播图数据
				//uniapp预览轮播图
				uni.previewImage({
					current: index, //预览图片的下标
					urls: i //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			getDetail() {
				httpRequest.request('/api/cccl/orderDetail', 'GET', {
					order_id: this.listid
				}, false, false, true).then(res => {
					this.dataAll = res.data
					this.pageShow = true
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.u-count-down__text {
		color: #ff0000
	}

	page {
		background-color: #f9f9f9;
	}

	.shilitu {
		width: 200rpx;
		height: 160rpx;

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>